
export const DEFAULT_COLUMNS = [
  {
    title: '关键词',
    key: 'search',
    show: false,
    disabled: true,
    search: {
      disabled: false
    },
    form: {
      disabled: true,
      component: {
        props: {
          clearable: true
        },
        placeholder: '请输入关键词'
      }
    },
    view: { // 查看对话框组件的单独配置
      disabled: true
    }
  },
  {
    title: 'ID',
    key: 'id',
    show: false,
    width: 90,
    form: {
      component: {
        show: false
      }
    }
  }]

export const ColumnsExcludeType = ['divider', 'static-text', 'grid-col', 'html-text', 'button']

export const DateRangeFields = ['time-range', 'date-range']
export const DateFields = ['date', 'time']


export const ColumnMappings = {
  common: {
    '\$.type': {selector: '\$.type'},
    '\$.title': {selector: 'options.label'},
    '\$.key': {selector: 'id'},
    '\$.show': {default: true},
    '\$.search.disabled': {default: false},
    '\$.form': {
      default: {
        component: {
          show: false
        }
      }
    },
    '\$.formOptions': {selector: '\$.options'}
  },
  'date': {
    "\$.search.component": {
      default: {
        style: {width: '300px'},
        name: 'el-date-picker',
        props: {
          type: '\$.options.type|range',
          'range-separator': '至',
          'start-placeholder': '开始',
          'end-placeholder': '结束',
          valueFormat: '\$.options.format',
          format: '\$.options.format'
        },
        iterable: true,
      }
    },
  },
  'time-range': {
    "\$.search.component": {
      default: {
        'name': 'el-time-picker',
        style: {width: '200px'},
        props: {
          isRange: true,
          rangeSeparator: "至",
          startPlaceholder: "开始时间",
          valueFormat: 'HH:mm:ss',
          endPlaceholder: "结束时间",
          placeholder: "选择时间范围"
        }
      }
    },
  },
  'checkbox': {
    '\$.dict.data': {
      selector: '\$.options.optionItems'
    },
  },
  'select': {
    '\$.dict.data': {
      selector: '\$.options.optionItems'
    },
  }

}
// 新增字段时必须新增
export const ColumnRestoreMap = [
  '\$.show',
  '\$.search.disabled',
  '\$.filter',
  '\$.filterPlacement',
  '\$.filterMultiple'
]

export const DefaultColumnMap = {
  options: {
    stripe: true,
    border: false,
  },
  pageOptions: {

  },
  search: {},
  formOptions: {type: 'dialog'},
}


export const DatetimeFormatOptions = {
  'date': [{value: 'yyyy-MM-dd', label: 'yyyy-MM-dd'}],
  'dates': [{value: 'yyyy-MM-dd', label: 'yyyy-MM-dd'}],
  'datetime': [
    {value: 'yyyy-MM-dd HH:mm:ss', label: 'yyyy-MM-dd HH:mm:ss'},
    {value: 'yyyy-MM-dd HH:mm', label: 'yyyy-MM-dd HH:mm'},
  ],
  'year': [
    {value: 'yyyy', label: 'yyyy'},
  ],
  'month': [{value: 'yyyy-MM', label: 'yyyy-MM'},],
  'week': [{value: 'yyyy 第 WW 周', label: 'yyyy 第 WW 周'},]

}
